package org.example.lotterysystem.controller.param;

import jakarta.validation.constraints.NotBlank;
import lombok.EqualsAndHashCode;

import java.util.Objects;

@EqualsAndHashCode(callSuper = true)
public class UserPasswordLoginParam extends UserLoginParam{
    /**
     * 手机或者邮箱
     */
    @NotBlank(message = "手机或邮箱不能为空！")
    private String loginName;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空！")
    private String password;

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    @Override
    public boolean equals(Object object) {
        super.equals(object);
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;
        if (!super.equals(object)) return false;
        UserPasswordLoginParam that = (UserPasswordLoginParam) object;
        return Objects.equals(loginName, that.loginName) && Objects.equals(password, that.password);
    }

    @Override
    public int hashCode() {
        return Objects.hash(loginName, password);
    }
}
